//
//  LiJiHuanKuanViewController.m
//  wangzhe
//
//  Created by 李 佳伟 on 2018/3/5.
//  Copyright © 2018年 李 佳伟. All rights reserved.
//

#import "NewHuanKuanPlanViewController.h"
#import "JTCSM.h"
#import "NewShengChengPlanViewController.h"


static CGFloat space = 20;
static CGFloat imagesize = 40;
static CGFloat labelHeight = 30;
@interface NewHuanKuanPlanViewController ()
{
    UIImageView *headerImagev;
    UILabel *banknameLabel;
    UILabel *bankcardLabel;
    UITextField *moneyTextfield;
    UILabel *bankname;
    UILabel *monyNum;
    UILabel *huankuanqLabel;
    UILabel *huankuanriLabel;
}
@end

@implementation NewHuanKuanPlanViewController

- (void)gotBack{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.hidden = NO;
    [df isRemoveTarbar:YES];
    self.view.backgroundColor = RGBACOLOR(241, 241, 241, 1);
    leftBarButtonItems_rightBarButtonItems *leftbtn = KCUSTOMNAVIGSTION_ALLOC;
    self.navigationItem.leftBarButtonItem = [leftbtn setBarButtonItemsImageName:@"fanhui.png" frame:KLeftBarButtonItemFrame_image target:self SEL:@selector(gotBack)];
    // Do any additional setup after loading the view.
    [self layoutview];
}

- (void)layoutview{
    

    CGFloat backviewWidth = KCONTROLLERWith-20;
   
    UIImageView *backview = [[UIImageView alloc]initWithFrame:CGRectMake(10, 0,backviewWidth , backviewWidth*0.317333)];
    backview.image = [UIImage imageNamed:@"蓝银行卡.png"];
    [self.view addSubview:backview];
    
    CGFloat top = (backview.LC_height-2*labelHeight)/2;
    
    headerImagev = [[UIImageView alloc]initWithFrame:CGRectMake(space, (backview.LC_height-imagesize)/2, imagesize, imagesize)];
    [backview addSubview:headerImagev];
    
    banknameLabel = [UILabel initWithFrame:CGRectMake(KVIEW_X(headerImagev)+space, top, KSCREENWidth, labelHeight) text:@"dfvdfvdfvdf" font:16 textAlignment:NSTextAlignmentLeft texcolor:[UIColor whiteColor] backgroundColor:nil];
    [backview addSubview:banknameLabel];
    
    CGFloat changespace = backviewWidth*0.0195555;
    huankuanriLabel = [UILabel initWithFrame:CGRectMake(backviewWidth-300-changespace, top, 280, labelHeight) text:@"还款日：每月28号" font:13 textAlignment:NSTextAlignmentRight texcolor:[UIColor whiteColor] backgroundColor:nil];
    [backview addSubview:huankuanriLabel];
    
    bankcardLabel = [UILabel initWithFrame:CGRectMake(KVIEW_X(headerImagev)+space, KVIEW_Y(banknameLabel), KSCREENWidth, labelHeight) text:@"123312312312" font:16 textAlignment:NSTextAlignmentLeft texcolor:[UIColor whiteColor] backgroundColor:nil];
    [backview addSubview:bankcardLabel];
    
    
    /////////////////////////////
    
    
    UIView *bottomView = [[UIView alloc]initWithFrame:CGRectMake(0, KVIEW_Y(backview), KCONTROLLERWith, 290)];
    bottomView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:bottomView];
    
    UILabel *jiaoyiLabel = [UILabel initWithFrame:CGRectMake(20, 20, KCONTROLLERWith, 20) text:@"交易金额" font:14 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(51, 51, 51, 1) backgroundColor:nil];
    [bottomView addSubview:jiaoyiLabel];
    NSString *titleStr = @"¥";
    float fontsize = 22;
    CGRect rect = [df labelHeightWithContent:titleStr height:30 font:fontsize];
    UILabel *$label =[UILabel initWithFrame:CGRectMake(20, KVIEW_Y(jiaoyiLabel)+20, rect.size.width, rect.size.height) text:titleStr font:fontsize textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(51, 51, 51, 1) backgroundColor:nil];
    [bottomView addSubview:$label];
    
    moneyTextfield = [UITextField initWithframe:CGRectMake(KVIEW_X($label)+10, KVIEW_Y(jiaoyiLabel)+20, KCONTROLLERWith, rect.size.height) backgrandColor:nil placeholder:@"输入金额" textAlignment:NSTextAlignmentLeft font:fontsize texcolor:RGBACOLOR(51,51,51,1)];
    [bottomView addSubview:moneyTextfield];
    
    [df newlineViewWithHeightofTop:KVIEW_Y(moneyTextfield)+20 superView:bottomView spacing:0 color:RGBACOLOR(241, 241, 241, 1) lineHeight:1];
    
    
    
    
    
    ////////////////////////////////

    CGFloat imagesize = 15;
    CGFloat height = 50;
    
    UIView *huankuanqView = [[UIView alloc]initWithFrame:CGRectMake(0, 120, KCONTROLLERWith, 70)];
    [bottomView addSubview:huankuanqView];
    huankuanqView.userInteractionEnabled = YES;
    
    UILabel *huankuanqtitle = [UILabel initWithFrame:CGRectMake(20, 0, KCONTROLLERWith/2-20, 40) text:@"还款期限" font:14 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(51, 51, 51, 1) backgroundColor:nil];
    [huankuanqView addSubview:huankuanqtitle];
    
    UIImageView *huankuanqimagev = [[UIImageView alloc]initWithFrame:CGRectMake(KCONTROLLERWith-20-imagesize, (70-imagesize)/2, imagesize, imagesize)];
    huankuanqimagev.image = [UIImage imageNamed:@"myFanhui.png"];
    [huankuanqView addSubview:huankuanqimagev];
    
    huankuanqLabel = [UILabel initWithFrame:CGRectMake(KCONTROLLERWith/2, 0, KCONTROLLERWith/2-20-imagesize, 70) text:@"8天" font:14 textAlignment:NSTextAlignmentRight texcolor:RGBACOLOR(51, 51, 51, 1) backgroundColor:nil];
    [huankuanqView addSubview:huankuanqLabel];
    
    NSString *tishiStr = @"还款期限不低于3天，合理还款建议大于等于5天以上";
    CGRect tishirect = [df labelHeightWithContent:tishiStr height:20 font:11];
    UILabel *tishiLabel = [UILabel initWithFrame:CGRectMake(20, KVIEW_Y(huankuanqtitle), tishirect.size.width, tishirect.size.height) text:tishiStr font:11 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(153, 153, 153, 1) backgroundColor:nil];
    [huankuanqView addSubview:tishiLabel];
    [df newlineViewWithHeightofTop:70 superView:huankuanqView spacing:20 color:RGBACOLOR(241, 241, 241, 1) lineHeight:1];
    
    
    ////////////////////////////////
    
    UIView *bankView = [[UIView alloc]initWithFrame:CGRectMake(0, KVIEW_Y(huankuanqView), KCONTROLLERWith, height)];
    [bottomView addSubview:bankView];
    bottomView.userInteractionEnabled = YES;
    backview.userInteractionEnabled = YES;
    
    UILabel *banktitle = [UILabel initWithFrame:CGRectMake(20, 0, KCONTROLLERWith/2-20, height) text:@"付款银行" font:14 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(51, 51, 51, 1) backgroundColor:nil];
    [bankView addSubview:banktitle];
    
    UIImageView *jiantouimagev = [[UIImageView alloc]initWithFrame:CGRectMake(KCONTROLLERWith-20-imagesize, (height-imagesize)/2, imagesize, imagesize)];
    jiantouimagev.image = [UIImage imageNamed:@"myFanhui.png"];
    [bankView addSubview:jiantouimagev];
    
    bankname = [UILabel initWithFrame:CGRectMake(KCONTROLLERWith/2, 0, KCONTROLLERWith/2-20-imagesize, height) text:@"招商银行（8463）" font:14 textAlignment:NSTextAlignmentRight texcolor:RGBACOLOR(51, 51, 51, 1) backgroundColor:nil];
    [bankView addSubview:bankname];
    
    [df newlineViewWithHeightofTop:KVIEW_Y(bankView) superView:bottomView spacing:20 color:RGBACOLOR(241, 241, 241, 1) lineHeight:1];
    
    ////////////////////////////////

    UILabel *moneytitle = [UILabel initWithFrame:CGRectMake(20, KVIEW_Y(bankView), KCONTROLLERWith/2-20, height) text:@"实际还款金额" font:14 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(51, 51, 51, 1) backgroundColor:nil];
    [bottomView addSubview:moneytitle];
    
    monyNum = [UILabel initWithFrame:CGRectMake(KCONTROLLERWith/2, KVIEW_Y(bankView), KCONTROLLERWith/2-20, height) text:@"0.00" font:14 textAlignment:NSTextAlignmentRight texcolor:RGBACOLOR(51, 51, 51, 1) backgroundColor:nil];
    [bottomView addSubview:monyNum];
    
    CGFloat labelheight = 50;
    CGFloat headerImagesize = 15;
    UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(20, KVIEW_Y(bottomView)+(labelheight-headerImagesize)/2, headerImagesize, headerImagesize)];
    imageView.image = [UIImage imageNamed:@"设置金额_注.png"];
    [self.view addSubview:imageView];
    UILabel *label = [UILabel initWithFrame:CGRectMake(KVIEW_X(imageView)+10 , KVIEW_Y(bottomView), KCONTROLLERWith, labelheight) text:@"订单按6%随机生成" font:15 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(51, 51, 51, 1) backgroundColor:nil];
    [self.view addSubview:label];
    
    UIButton *tijiaobutton = [UIButton buttonWithType:UIButtonTypeCustom];
    tijiaobutton.frame = CGRectMake(25, KVIEW_Y(label)+30, KCONTROLLERWith-40, 50);
    [tijiaobutton addTarget:self action:@selector(tijiao) forControlEvents:UIControlEventTouchUpInside];
    [df layerWithView:tijiaobutton radius:25 width:0 color:nil];
    tijiaobutton.backgroundColor = KZhuTiRGB;
    [tijiaobutton setTitleColor:RGBACOLOR(51, 51, 51, 1) forState:UIControlStateNormal];
    [tijiaobutton setTitle:@"生成订单" forState:UIControlStateNormal];
    [self.view addSubview:tijiaobutton];
    
}
- (void)tijiao{
    NewShengChengPlanViewController *vc = [[NewShengChengPlanViewController alloc]init];
    vc.nameTitle = @"生成计划";
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end

